#数据分组id test v2
ADMIN_USER_ID = 1

#已开仓
DEAL_RESULT_STATUS_OPENING = 0
#下单异常
DEAL_RESULT_STATUS_EXCEPTION = -2;


#成交异常
DEAL_RESULT_STATUS_EXCEPTION = -1
#
DEAL_RESULT_STATUS_FINISH = 9


# 交易所 code
SYS_EXCHANGE_CODE_OKEX_SPOT = "OKEX_SPOT"
SYS_EXCHANGE_CODE_OKEX_FUTRUE = "OKEX_FUTURE"
SYS_EXCHANGE_CODE_HUOBI = "HUOBI"
SYS_EXCHANGE_CODE_BM = "BM"

SYS_FUDING_PREFIX = "funding";
SYS_FUDING_NEXT_PREFIX = "funding_next";

#binance
SYS_EXCHANGE_CODE_BINANCE = "BINA"
# 交易所订单详情状态
SYS_ORDER_STATUS_CLOSE = 'ORDER_STATE_CLOSED'
SYS_ORDER_STATUS_CANCELED = 'ORDER_STATE_CANCELED'
SYS_ORDER_STATUS_PENDING = 'ORDER_STATE_PENDING'
SYS_ORDER_STATUS_PART_DEAL = 'ORDER_STATE_PART'
#交易方向
FUTURE_DEAL_OPEN_POSITION_DIRECTION_BUY = 1
FUTURE_DEAL_OPEN_POSITION_DIRECTION_SELL= 2
# 3:平多 4:平空
FUTURE_DEAL_CLOSE_POSITION_DIRECTION_BUY = 3
FUTURE_DEAL_CLOSE_POSITION_DIRECTION_SELL= 4


# 交易明细状态
DEAIL_DETAIL_STATUS_PENDING = 1 #初始状态 等待开仓
DEAIL_DETAIL_STATUS_OPENING_1 = 2 # 挂单方已下单
DEAIL_DETAIL_STATUS_OPENING_2 = 3 #挂单方成交
DEAIL_DETAIL_STATUS_OPENING_3 = 4 #开仓完成 市价单已成
DEAIL_DETAIL_STATUS_OPENING_4 = 20 #开仓已撤单
DEAIL_DETAIL_STATUS_OPENING_5 = -1 #无效开仓
DEAIL_DETAIL_STATUS_CLOSED_1 = 5 #挂单方已下单
DEAIL_DETAIL_STATUS_CLOSED_2 = 6 #挂单方已成交
DEAIL_DETAIL_STATUS_CLOSED_3 = 7 #平仓完成 市价方成交
DEAIL_DETAIL_STATUS_CLOSEING = 31 #平仓中
DEAIL_DETAIL_STATUS_CLOSED_4 = 30 #平仓已撤单

DEAIL_DETAIL_STATUS_OPEN_FANXIANG = 40 # 开仓 异常反向操作已下单
DEAIL_DETAIL_STATUS_OPEN_FANXIANG_COMPLETE = 41  # 开仓敞口处理反向操作已经成交

DEAIL_DETAIL_STATUS_OPEN_GETORDER_FAILTURE = -41

DEAIL_DETAIL_STATUS_CLOSE_FANXIANG = 50 # 平仓 异常 反向操作已下单
DEAIL_DETAIL_STATUS_CLOSE_FANXIANG_COMPLETE = 51 # 平仓敞口敞口反向操作下单已成交

DEAIL_DETAIL_STATUS_CLOSE_FANXIANG_FAILTURE = -50 # #平仓敞口处理失败

DEAIL_DETAIL_STATUS_CLOSE_GETORDER_FAILTURE = -51 #平仓敞口处理订单获取失败

#交易类型 限价
DEAL_TYPE_LIMIT = 1
#市价
DEAL_TYPE_MARKET = 2


DEAIL_DETAIL_STATUS_CHANKOU_CLOSE= 30


POSITION_PD_LONG = 1
POSITION_PD_SHORT = 2

class deal_detail:
    # def __init__(self,deal_strategy_id,spot_coin_name,future_coin_name,spot_exchange,
    #     future_exchange,spot_open_price,future_open_price,spot_open_time,
    #     future_open_time,spot_close_price,future_close_price,spot_close_time,future_close_time,status,
    #              error_msg,guadan_position,spot_open_position_order_id,futrue_open_position_order_id,
    #              spot_close_position_order_id,futrue_close_position_order_id):
    def __init__(self):
        self.id = ''
        self.deal_strategy_id = ''
        self.spot_coin_name = ''
        self.future_coin_name = ''
        self.spot_exchange = ''
        self.future_exchange = ''
        self.spot_open_price = ''
        self.future_open_price = ''
        self.future_open_amount = ''
        self.spot_open_amount = ''
        self.spot_open_time = ''
        self.future_open_time = ''
        self.spot_close_price = ''
        self.future_close_price = ''
        self.spot_close_time = ''
        self.future_close_time = ''
        self.status = ''
        self.error_msg = ''
        self.guadan_position = ''
        self.spot_open_position_order_id = ''
        self.futrue_open_position_order_id = ''
        self.spot_close_position_order_id = ''
        self.futrue_close_position_order_id = ''
        self.per_deal_limit = ''
        self.future_contract_type = ''
        self.open_deal_direction = -1
        self.deal_profit = 0


